package day20171007;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import java.io.FileWriter;
import java.io.IOException;

/**
 * Created by 14394 on 2017/10/7.
 */
public class GrabWeb {
    public static void main(String[] args) throws IOException {
        Document d= Jsoup.connect("http://entertainment-100.view.sitestar.cn/").get();
        FileWriter fw=null;
        int j=d.body().getAllElements().size();
        for (int i=0;i<j;i++){
         try {
             fw=new FileWriter("D:/dev/sctu-java-2017-1/1606102009陈开海/src/day20171007/Grab.txt",true);
            fw.write(String.valueOf(d.body().getAllElements().get(i)));
            fw.write("\n");
         }catch (IOException e){
             e.printStackTrace();
         }finally {
             if (fw!=null){
                 try {
                     fw.close();
                 }catch (IOException e){
                     e.printStackTrace();
                 }
             }
         }
        }
    }
}
